<template>
  <div class="all">
    <div class="header">
      <div style="width: 80px">
        <!-- <img
          src="@/assets/role01.png"
          alt=""
          width="18px"
          height="20px"
        /> -->
      </div>
      <div class="title">个人中心</div>
      <div class="change" style="width: 80px">
        <!-- <div><van-icon name="sort" />切换身份</div> -->
      </div>
    </div>
    <div class="renterandbuy">
      <div class="info">
        <div class="lbox">
          <div style="width: 63px" />
          <van-image width="80" height="80" :src="require('../../assets/yt.jpg')" round fit="cover" @click="showImage"/>
          <!-- <div>
            <img src="@/assets/yt.jpg" alt="" @click="showImage" />
          </div> -->
          <div>
            <img src="../../assets/mename.png" alt="" /><span>杨婷</span>
          </div>
        </div>
        <div class="bbox">{{ username }}</div>
      </div>
      <div class="card">
        <div class="see">
          <span>我的备忘录</span>
        </div>
        <div class="out">
          <span class="moeny">{{ getTime }}</span>
          <van-button type="warning" round @click="$router.push('/memorandum')">进 入</van-button>
        </div>
      </div>
      <div class="tool">
        <div class="tip">我的工具</div>
        <div class="cell" @click="goBill">
          <img src="../../assets/me12.png" alt="" />
          <span>添加账单</span>
          <div style="flex: 1" />
          <van-icon name="arrow" />
        </div>
        <div class="cell" @click="$router.push('/billingStatistics')">
          <img src="../../assets/me15.png" alt="" />
          <span>账单统计</span>
          <div style="flex: 1" />
          <van-icon name="arrow" />
        </div>
        <div class="cell" @click="jumptoset">
          <img src="../../assets/me05.png" alt="" />
          <span>个人设置</span>
          <div style="flex: 1" />
          <van-icon name="arrow" />
        </div>
      </div>
    </div>
    <van-overlay :show="show" @click="show = false">
      <div ref="qrcodeDom" class="erwei"></div>
    </van-overlay>
  </div>
</template>

<script>
import {
  getSecret,
  getUserId,
  getInitialize,
  getChooseCity,
} from "@/utils/auth";
import { mapGetters } from "vuex";
import { _local, _session } from "@/utils/storage";
import { getUserInfo, shareLink } from "../../apis/user.js";
import QRCode from "qrcodejs2";
import { shareIntegral } from "@/apis/integral";
import { getTime } from "@/utils/publicMethods";
import { ImagePreview } from "vant";

export default {
  data() {
    return {
      agentVip: 0,
      show: false,
      agentCityCode: "",
      userId: "",
      count: 0,
      contactOwnerNum: 0,
      value: 5,
      username: "",
      swiperOption: {
        slidesPerView: 3,
        spaceBetween: 10,
        loop: true,
      },
      avatar: "",
      showAgentExpire: true,
    };
  },
  created() {

  },
  computed: {
    getTime() {
      return getTime()
    },
  },
  methods: {
    showImage() {
      ImagePreview({
        images: [
          'yt.jpg'
        ],
        loop: false,
        startPosition: 0
      })
    },
    goBill() {
      this.$router.push('/myBill')
    },
    jumptoset() {
      this.$router.push({ path: "/setting" });
    },
  }
};
</script>

<style lang="less" scoped>
.erwei {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.jingcard {
  width: 92vw;
  margin: auto;
  margin-top: -35px;
  background-color: #ffffff;
  box-shadow: 0px 0px 10px 5px #0a0b2f1e;
  border-radius: 10px;

  .top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-image: linear-gradient(to top, #222222, #54534e);
    padding: 15px 20px;
    border-radius: 10px 10px 0 0;

    &>div:nth-child(1) {
      &>div:nth-child(1) {
        color: #fcedd3;
        margin-bottom: 10px;
        font-size: 15px;
      }

      &>div:nth-child(2) {
        color: #e4e4e4;
        font-size: 18px;
        font-weight: bold;

        .van-icon {
          margin-left: 5px;
          vertical-align: baseline;
        }
      }
    }

    &>div:nth-child(2) {
      button:active {
        background-color: #ffe2b17f;
      }

      button {
        background-color: #ffe3b1;
        width: 69px;
        height: 28px;
        text-align: center;
        border-radius: 14px;
        color: #52514c;
        font-weight: bold;
        font-size: 15px;
        border: 0;
      }
    }
  }

  .bottom {
    display: flex;
    justify-content: space-between;
    margin: 20px 20px 10px;
    padding: 0 0 10px;

    .up {
      color: #d43b33;
      font-size: 20px;
      font-weight: bolder;
      margin-bottom: 10px;
      text-align: center;
    }

    .und {
      font-size: 12px;
      color: #524c4c;
    }
  }
}

@keyframes change {
  0% {
    font-size: 16px;
    font-weight: bold;
  }

  100% {
    font-size: 18px;
    font-weight: bold;
  }
}

.header {
  position: fixed;
  left: 0;
  top: 0;
  padding: 10px 15px;
  z-index: 10;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  font-size: 15px;
  color: #fff;

  .title {
    line-height: 25px;
    height: 25px;
    font-size: 18px;
    font-weight: bold;
  }

  .change {
    font-size: 13px;

    div {
      display: flex;
      align-items: center;
      justify-content: flex-end;
    }
  }
}

.info {
  height: 295px;
  background: url("../../assets/mebg01.png") 0px 0px no-repeat;
  background-size: 100% 100%;
  box-sizing: border-box;
  padding: 50px 55px 0;
}

.cardmai {
  margin: 10px 15px;
  padding: 15px 25px;
  border-radius: 10px;
  background-color: #fff;
  font-size: 13px;
  box-shadow: 0px 0px 10px 5px #e0f3f7;
  margin-top: -35px;
  display: flex;
  justify-content: space-between;
  text-align: center;

  .icon {
    transform: translateY(30px);
  }

  .see {
    font-size: 14px;
    margin-bottom: 5px;

    div:nth-child(2) {
      margin-top: 10px;
      color: #d43b33;
      font-size: 25px;
      font-weight: bold;
    }
  }

  .out {
    display: flex;
    justify-content: space-between;
    flex-wrap: nowrap;

    .btn {
      transform: translateY(-12px);
      width: 85px;
      height: 33px;
      min-width: 85px;
      white-space: nowrap;
      background-color: #45b7cb;
      color: white;
      font-weight: 400;
      font-size: 15px;
    }
  }

  .moeny {
    color: #d43b33;
    font-size: 25px;
    font-weight: bold;
  }

  .moeny2 {
    color: #d43b33;
    font-size: 20px;
    font-weight: bold;
  }

  .tixian {
    font-size: 12px;
    border-radius: 15px;
    height: 30px;
    width: 70px;
    min-width: 70px;
    white-space: nowrap;
    background-color: #fff;
    border: 1px solid #45b7cb;
    color: #45b7cd;
  }

  .xbox {
    display: flex;
    justify-content: space-between;

    >div {
      width: 45%;
      margin-top: 15px;
    }
  }

  .more {
    color: #333;
    font-size: 16px;
    background-color: #eee;
    border-radius: 50%;
    margin-left: 5px;
    padding: 2px;
  }

  .say {
    display: flex;
    align-items: center;

    >.van-icon {
      font-size: 16px;
      margin-left: 5px;
    }
  }
}

.card {
  margin: 10px 15px;
  padding: 15px 25px;
  border-radius: 10px;
  background-color: #fff;
  font-size: 13px;
  box-shadow: 0px 0px 10px 5px #e0f3f7;
  margin-top: -35px;

  .see {
    font-size: 18px;
    margin-bottom: 15px;

    .icon {
      transform: translateY(30px);
      margin-left: 10px;
    }
  }

  .out {
    display: flex;
    justify-content: space-between;
    flex-wrap: nowrap;
    align-items: center;

    .btn {
      transform: translateY(-12px);
      width: 85px;
      height: 33px;
      min-width: 85px;
      white-space: nowrap;
      background-color: #45b7cb;
      color: white;
      font-weight: 400;
      font-size: 15px;
    }
  }

  .moeny {
    background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, purple);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 14px;
    font-weight: bold;
  }

  .moeny2 {
    color: #d43b33;
    font-size: 12px;
    font-weight: bold;
  }

  .tixian:active {
    background-color: #ddd;
  }

  .tixian {
    font-size: 12px;
    border-radius: 15px;
    height: 30px;
    width: 70px;
    min-width: 70px;
    white-space: nowrap;
    background-color: #fff;
    border: 1px solid #45b7cb;
    color: #45b7cd;
  }

  .xbox {
    display: flex;
    justify-content: space-between;

    >div {
      width: 45%;
      margin-top: 15px;
    }
  }

  .more {
    color: #333;
    font-size: 16px;
    background-color: #eee;
    border-radius: 50%;
    margin-left: 5px;
    padding: 2px;
  }

  .say {
    display: flex;
    align-items: center;

    >.van-icon {
      font-size: 16px;
      margin-left: 5px;
    }
  }
}

.tool {
  border-radius: 10px;
  margin: 20px 15px 25px;
  box-shadow: 0px 1px 10px 5px #eee;

  .tip {
    padding: 15px;
    font-size: 16px;
    color: #333;
    font-weight: bold;
  }

  .cell {
    padding: 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f1f1f1;
    color: #333;
    font-size: 13px;
    font-weight: bold;

    img {
      margin-right: 10px;
      width: 14px;
      height: 14px;
    }
  }
}

.unlogin {
  .info {
    height: 255px;
    padding: 65px 55px 0;
    text-align: center;

    .lbox {
      margin: 0 auto;
      width: 60px;
      height: 60px;
      border-radius: 50%;
      background-color: #fff;
      border: 4px solid #fff;
      display: flex;
      justify-content: center;
      align-items: center;

      >img {
        width: 50px;
        height: 50px;
      }
    }

    .bbox {
      text-align: center;
      font-size: 20px;
      color: #fff;
      margin-top: 5px;
      font-weight: bold;
    }
  }

  .tool {
    margin-top: -40px;
  }

  .tool2 {
    margin-top: 10px;
  }
}

.agent {
  .info {
    display: flex;
    justify-content: space-between;

    .leftbox {
      position: relative;

      div {
        &:first-child {
          width: 60px;
          height: 60px;
          border: 2px solid #fff;
          border-radius: 50%;
          background-color: #fff;
          display: flex;
          justify-content: center;
          align-items: center;

          >img {
            border-radius: 50%;
            width: 55px;
            height: 55px;
          }
        }

        &:nth-child(2) {
          text-align: center;
          font-size: 16px;
          color: #fff;
          margin-top: 7px;
        }

        &:nth-child(3) {
          margin-top: 3px;
          position: relative;
          text-align: center;

          >img {
            position: absolute;
            width: 22px;
            height: 22px;
            border-radius: 50%;
            left: -5px;
            top: -2px;
          }

          span {
            display: inline-block;
            padding: 0px 4px 1px 15px;
            font-size: 12px;
            background-color: #fff;
            color: #45b7cb;
            border-radius: 10px;
          }
        }
      }

      .vip {
        width: 20px;
        position: absolute;
        top: 0px;
        right: 0px;
      }
    }

    .rightbox {
      padding-top: 25px;

      >div {
        color: #fff;
        display: flex;
        align-items: center;
        font-size: 12px;
        margin-bottom: 8px;
      }
    }
  }

  .getorderimg {
    margin-top: 10px;
    box-sizing: border-box;
    padding: 0 15px;
    width: 100%;
  }

  .getorder {
    position: relative;
  }

  .li {
    position: absolute;
    bottom: 4.5vh;
    right: 11.2vw;
    color: #ff002e;
    font-weight: bold;
    animation: change 1s infinite linear;
    transition: 2s;
  }

  .tool {
    margin-top: 10px;
  }
}

.renterandbuy {
  .info {
    height: 255px;
    padding: 65px 55px 0;

    .lbox {
      display: flex;
      justify-content: center;
      align-items: center;

      >div {
        &:nth-child(2) {
          width: 60px;
          height: 60px;
          border-radius: 50%;
          background-color: #fff;
          border: 2px solid #fff;
          display: flex;
          justify-content: center;
          align-items: center;

          >img {
            width: 55px;
            height: 55px;
            border-radius: 50%;
          }
        }

        &:last-child {
          padding-left: 20px;
          margin-top: 3px;
          position: relative;
          text-align: center;

          >img {
            position: absolute;
            width: 22px;
            height: 22px;
            border-radius: 50%;
            left: 11px;
            top: -2px;
          }

          span {
            display: inline-block;
            padding: 0px 4px 1px 15px;
            font-size: 12px;
            background-color: #fff;
            color: #45b7cb;
            border-radius: 10px;
          }
        }
      }
    }

    .bbox {
      text-align: center;
      font-size: 16px;
      color: #fff;
      margin-top: 5px;
    }
  }

  .tobuyserve {
    margin: 10px 15px 0 15px;
    height: 160px;
    display: flex;
    align-items: center;

    .item {
      position: absolute;
      bottom: 0;
      margin-right: 9px;
      width: 105px;
      height: 135px;
      border: 1px solid #f1f1f1;
      text-align: center;
      border-radius: 5px;

      >div {
        &:first-child {
          color: #fff;
          font-size: 15px;
          padding: 5px 0;
          border-radius: 5px 5px 0 0;
        }

        &:nth-child(2) {
          color: #666;
          font-size: 12px;
          padding-top: 12px;
          padding-left: 16px;
          text-align: left;
        }

        &:nth-child(3) {
          text-align: left;
          font-size: 12px;
          color: #666;
          padding-left: 16px;
          padding-bottom: 15px;
        }

        &:nth-child(4) {
          margin: 0 auto;
          width: 75px;
          height: 28px;
          font-size: 16px;
          color: #fff;
          line-height: 28px;
          border-radius: 15px;
        }
      }
    }

    .swiper {
      width: 100%;
      height: 150px;

      .swiper-slide {
        position: relative;
      }

      .swiper-slide-next {
        .item {
          height: 145px;

          div {
            &:first-child {
              border-radius: 5px 5px 0 0;
              padding: 10px 0;
            }
          }
        }
      }
    }
  }

  .buyserve {
    border-top: 1px solid #f1f1f1;
    margin-top: 10px;
    padding-top: 10px;
    display: flex;
    justify-content: space-between;

    .leftbox {
      .chone {
        margin-top: 5px;
        font-size: 14px;
        font-weight: bold;
        color: #333 !important;

        span {
          font-size: 18px;
          color: #d43b33;
        }
      }
    }

    .rightbox {
      text-align: center;
      font-size: 14px;

      .buy {
        color: #45b7cb;
        width: 70px;
        height: 30px;
        line-height: 30px;
        border-radius: 15px;
      }

      .forback {
        width: 90px;
        height: 34px;
        line-height: 34px;
        border: 1px solid #45b7cb;
        color: #666;
        border-radius: 15px;
      }
    }
  }
}

.rentowner,
.owner {
  .info {
    height: 255px;
    padding: 65px 55px 0;

    .lbox {
      display: flex;
      justify-content: center;
      align-items: center;

      >div {
        &:nth-child(2) {
          width: 60px;
          height: 60px;
          border-radius: 50%;
          background-color: #fff;
          border: 2px solid #fff;
          display: flex;
          justify-content: center;
          align-items: center;

          >img {
            width: 55px;
            height: 55px;
            border-radius: 50%;
          }
        }

        &:last-child {
          padding-left: 20px;
          margin-top: 3px;
          position: relative;
          text-align: center;

          >img {
            position: absolute;
            width: 22px;
            height: 22px;
            border-radius: 50%;
            left: 11px;
            top: -2px;
          }

          span {
            display: inline-block;
            padding: 0px 4px 1px 15px;
            font-size: 12px;
            background-color: #fff;
            color: #45b7cb;
            border-radius: 10px;
          }
        }
      }
    }

    .bbox {
      text-align: center;
      font-size: 16px;
      color: #fff;
      margin-top: 5px;
    }
  }
}
</style>
